package com.example.farmer.Entity;

public class ChatMessage {
    private int id;
    private int productId;
    private String sender; // "user" or "support"
    private String recipient; // "user" or "support"
    private String messageContent;
    private long timestamp;

    private boolean isRead;
    private String userNumber;

    // Constructor, getters, and setters

    public ChatMessage(int id,int productId,String sender,String messageContent,long timestamp,boolean isRead,String userNumber){
        this.id = id;
        this.productId = productId;
        this.sender = sender;
        this.messageContent = messageContent;
        this.timestamp = timestamp;
        this.isRead = isRead;
        this.userNumber = userNumber;
    }

    public ChatMessage(int id,int productId,String sender,String messageContent,long timestamp,boolean isRead){
        this.id = id;
        this.productId = productId;
        this.sender = sender;
        this.messageContent = messageContent;
        this.timestamp = timestamp;
        this.isRead = isRead;
        this.userNumber = userNumber;
    }

    public ChatMessage(int id,int productId,String sender,String recipient,String messageContent,long timestamp,boolean isRead){
        this.id = id;
        this.productId = productId;
        this.sender = sender;
        this.recipient = recipient;
        this.messageContent = messageContent;
        this.timestamp = timestamp;
        this.isRead = isRead;
        this.userNumber = userNumber;
    }

    public ChatMessage(int productId,String sender,String recipient,String messageContent,long timestamp,boolean isRead){
        this.productId = productId;
        this.sender = sender;
        this.recipient = recipient;
        this.messageContent = messageContent;
        this.timestamp = timestamp;
        this.isRead = isRead;
    }

    public ChatMessage(int id,String sender,String messageContent,long timestamp,boolean isRead){
        this.id = id;
        this.sender = sender;
        this.messageContent = messageContent;
        this.timestamp = timestamp;
        this.isRead = false;
    }
    public ChatMessage(){

    }


    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getProductId() {
        return productId;
    }

    public void setProductId(int productId) {
        this.productId = productId;
    }

    public String getMessageContent() {
        return messageContent;
    }

    public void setMessageContent(String messageContent) {
        this.messageContent = messageContent;
    }

    public long getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(long timestamp) {
        this.timestamp = timestamp;
    }

    public String getSender() {
        return sender;
    }

    public void setSender(String sender) {
        this.sender = sender;
    }

    public String getRecipient() {
        return recipient;
    }

    public void setRecipient(String recipient) {
        this.recipient = recipient;
    }

    public boolean isRead() {
        return isRead;
    }

    public void setRead(boolean read) {
        isRead = read;
    }

    public String getUserNumber() {
        return userNumber;
    }

    public void setUserNumber(String userNumber) {
        this.userNumber = userNumber;
    }

    @Override
    public String toString() {
        return "ChatMessage{" +
                "id=" + id +
                ", productId=" + productId +
                ", sender='" + sender + '\'' +
                ", recipient='" + recipient + '\'' +
                ", messageContent='" + messageContent + '\'' +
                ", timestamp=" + timestamp +
                ", isRead=" + isRead +
                ", userNumber='" + userNumber + '\'' +
                '}';
    }
}